package leetcode.leetcode_226;

class Solution {
    public TreeNode invertTree(TreeNode root) {
        reverse( root);
        return root;
    }
    public void reverse(TreeNode root){
        if (root == null) return;
        TreeNode temp = root.left;
        root.left = root .right;
        root.right = temp;
        reverse(root.left);
        reverse(root.right);
    }
}